package com.aboverock.autoconfigure.properties;

import com.aboverock.common.constant.KbsmartConstant;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * The Class LocalUserProperties.
 *
 * @author Rock Wang
 */
@ConfigurationProperties("kbsmart.local.user")
public class LocalUserProperties {

    private boolean support = false;

    @Value("${spring.profiles.active}")
    private String active;

    /**
     * 是否支持本地数据库用户（dev和qa环境默认为true）.
     *
     * @return true, if is support
     */
    public boolean isSupport() {
        if (KbsmartConstant.Profile.DEVLOPMENT.equals(active)
                || KbsmartConstant.Profile.QUALITY_ASSURANCE.equals(active)) {
            return true;
        }
        return support;
    }

    public void setSupport(boolean support) {
        this.support = support;
    }

}
